package sk.atletis.atletika;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;

public class ArticlesDetailActivity extends FragmentActivity 
{
	@Override
	protected void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_articles_detail);
		
		getActionBar().setDisplayHomeAsUpEnabled(true);
		
		long articleID = getIntent().getLongExtra(ArticlesContract.ARTICLE_ID, 0);
		
		Fragment f = new ArticlesDetailFragment();
		
		Bundle args = new Bundle();
		args.putLong(ArticlesDetailFragment.ARTICLE_ID , articleID);
		f.setArguments(args);
		
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
		ft.replace(R.id.fragment_articles_detail, f);
		ft.commit();
	}
	
	@Override
    public boolean onOptionsItemSelected(MenuItem item) 
	{
        switch (item.getItemId()) 
        {
        	case android.R.id.home:
        		NavUtils.navigateUpFromSameTask(this);
				return true;
        }

        return super.onOptionsItemSelected(item);
    }
	
	
	
}
